package com.own.business.pay.entity.map;

import com.own.business.pay.entity.po.BillHistory;
import com.own.component.common.base.entity.BaseMap;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * BillHistoryMapVo
 *
 * @author chenxueli
 * @date 2023-08-28 17:14:41
 */
@Schema(title = "账单信息" + ConstantBeanSuffix.MAP_VO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class BillHistoryMapVo extends BaseMap<BillHistory> implements Serializable {

    @Schema(title = "用户id")
    private Long userId;

    @Schema(title = "交易类型（wechat、alipay、balance...）")
    private String tradeType;

    @Schema(title = "流水类型（1=收入 2=支出 3=退款）")
    private Integer type;

    @Schema(title = "商户单号")
    private String outTradeNo;

    @Schema(title = "业务类型")
    private String businessType;

    @Schema(title = "商户退款单号")
    private String outRefundNo;

    @Schema(title = "订单标题")
    private String subject;

    @Schema(title = "订单附加信息")
    private String body;

    @Schema(title = "订单总金额，单位为分")
    private Long totalAmount;

    @Schema(title = "退款金额，单位为分")
    private Long refundAmount;

    @Schema(title = "订单超时时间")
    private LocalDateTime expireTime;

    @Schema(title = "订单状态（1=新建 2=完成 4=订单关闭 5=超时取消）")
    private Integer status;

    @Schema(title = "交易时间")
    private LocalDateTime tradeTime;

    @Schema(title = "通知数据")
    private String notifyData;

    /**
     * 构造方法
     *
     * @param entity 原对象
     */
    public BillHistoryMapVo(@NonNull BillHistory entity) {
        super(entity);
        this.userId = entity.getFkUserId();
        this.tradeType = entity.getTradeType();
        this.type = entity.getType();
        this.outTradeNo = entity.getOutTradeNo();
        this.businessType = entity.getBusinessType();
        this.outRefundNo = entity.getOutRefundNo();
        this.subject = entity.getSubject();
        this.body = entity.getBody();
        this.totalAmount = entity.getTotalAmount();
        this.refundAmount = entity.getRefundAmount();
        this.expireTime = entity.getExpireTime();
        this.status = entity.getStatus();
        this.tradeTime = entity.getTradeTime();
        this.notifyData = entity.getNotifyData();
    }

}
